import VueRouter from 'vue-router'

const routes = [
    {
        path:'/login',
        name:'login',
        component:()=>import('../components/Login')

    },
    {
        path:'/',
        name:'index',
        component:()=>import('../components/Index'),
        children:[
            {
                path:'/home',
                name:'home',
                meta:{
                    title:'首页'
                },
                component:()=>import('../components/Home')
            },
            {
                path:'/user',
                name:'user',
                meta:{
                    title:'用户管理'
                },
                component:()=>import('../components/User')
            },
            {
                path:'/patient',
                name:'patient',
                meta:{
                    title:'患者管理'
                },
                component:()=>import('../components/Patient/PatientManger.vue')
            },
            {
                path:'/doctor',
                name:'doctor',
                meta:{
                    title:'医生管理'
                },
                component:()=>import('../components/Doctor/DoctorManger.vue')
            },
            {
                path:'/department',
                name:'department',
                meta:{
                    title:'医生管理'
                },
                component:()=>import('../components/Department/DepartmentManger.vue')
            },
            {
                path:'/medicine',
                name:'medicine',
                meta:{
                    title:'医生管理'
                },
                component:()=>import('../components/Medicine/MedicineManger.vue')
            },
            {
                path:'/appointment',
                name:'appointment',
                meta:{
                    title:'挂号管理'
                },
                component:()=>import('../components/Appointment/AppointmentDep.vue')
            },
        ]
    },
    {
        path:'/register',
        name:'register',
        component:()=>import('../components/Register'),
        children:[
            {
                path:'/Register',
                name:'register',
                meta:{
                    title:'注册页'
                },
                component:()=>import('../components/Register')
            }
        ]
    },
    {
        path:'/MyForm',
        name:'myform',
        component:()=>import('../components/User/User01/MyForm')
    },
    {
        path:'/Home01',
        name:'home01',
        component:()=>import('../components/User/Home01')
    },

]

const router = new VueRouter({
    mode:'history',
    routes
})

const VUeRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to){
    return VUeRouterPush.call(this,to).catch(err => err)
}

export default router;